home *** CD-ROM | disk | FTP | other *** search
- #include <asm.h>
- #include <Quickdraw.h>
- #include <MemoryMgr.h>
- #include <EventMgr.h>
-
- #define Chk(x) ((x) << 1 ^ 0x1021)
- #define KeyCode(x,y) (BitTst(&(x), (y) ^ 0x07))
- #define True (1)
- #define False (0)
-
- extern int icnVert : 0x928;
- extern int icnVChk : 0x92a;
- extern int icnHorz : 0x92c;
- extern int icnHChk : 0x92e;
- GrafPtr myPort;
-
- main()
- {
- KeyMap myKMap;
- ResType rType;
- Str255 name;
- void (*p)();
- THz myZone;
- int i, id;
- Handle h;
-
- myPort = (GrafPtr) NewPtr(sizeof(GrafPort));
- OpenPort(myPort);
- GetKeys(&myKMap);
- if (!Button() && !KeyCode(myKMap, 56))
- for (i = Count1Resources('code'); i > 0; --i) {
- if (h = Get1IndResource('code', i)) {
- asm {
- move.l h, a0
- _GetHandleSize
- move.w d0, id
- _NewPtr SYS
- move.l a0, p
- }
- BlockMove(*h, (Ptr) p, id);
- GetResInfo(h, &id, &rType, name);
- ReleaseResource(h);
- (*p)(); /* Call code for startup */
- DrawIcon(id, True);
- }
- }
- else DrawIcon(127, True);
- ClosePort(myPort);
- DisposPtr((Ptr) myPort);
- }
-
- /* This routines plots an icon onto the desktop. The variable 'icon' */
- /* holds an ID number of the ICN# resource to be plotted to the screen */
- /* and doInc is a flag that will make the next icon to be plotted, */
- /* plotted either on top of the last icon or next to the last icon. */
- /* This allows for 'animation sequences' if wanted. Other features */
- /* are: 'autowrap' or wrapping to the previous line when icon will be */
- /* plotted off the right hand side of the screen. This procedure */
- /* should be compatable with most previous ShowIcon algorithms. */
-
- DrawIcon(icon, doInc)
- int icon,
- doInc;
- {
- BitMap data, mask;
- Handle h;
- Rect dst;
-
- if (h = GetResource('ICN#', icon)) {
- if (Chk(icnVert) != icnVChk)
- icnVChk = Chk(icnVert = myPort->portBits.bounds.bottom - 40);
- if (Chk(icnHorz) != icnHChk)
- icnHChk = Chk(icnHorz = 8);
- if (icnHorz > myPort->portBits.bounds.right - 32) {
- icnHChk = Chk(icnHorz = 8);
- icnVChk = Chk(icnVert -= 40);
- }
- HLock(h);
- data.baseAddr = *h;
- mask.baseAddr = *h + 0x80;
- data.rowBytes = 4;
- mask.rowBytes = 4;
- SetRect(&data.bounds, 0, 0, 32, 32);
- SetRect(&mask.bounds, 0, 0, 32, 32);
- SetRect(&dst, icnHorz, icnVert, icnHorz + 32, icnVert + 32);
- CopyMask(&data, &mask, &myPort->portBits, &data.bounds,
- &mask.bounds, &dst);
- ReleaseResource(h);
- if (doInc) icnHChk = Chk(icnHorz += 40);
- }
- }
- --
-
- +--------------------------------------------------------------------+
- | From the Macintosh of: Kevin L. Sitze. This is ME: ksitze@NMSU.edu |
- +------------------------------------------------------+-------------+
- | The difference between intelligence and stupidity is | Is this |
- | that intelligence has a limit. -- anonymous | better? |
- +------------------------------------------------------+-------------+
-
-
-
-
- ˇ